public class test1 {
    public static int countSymmetricIntegers(int low, int high) {
        int ret = 0;
        for(int i = low;i <= high;i++){
            int count = 1;
            int mid = i;
            while(mid/10 != 0){
                count++;
                mid /= 10;
            }
            if(count % 2 != 0){
                continue;
            }
            mid = i;
            int left = 0;
            int right = 0;
            for(int j = 0;j < count;j++){
                if(j < count/2){
                    left += mid % 10;
                    mid /= 10;
                }else{
                    right += mid %10;
                    mid /= 10;
                }
            }
            if(left == right){
                ret++;
                System.out.println(i);
            }
        }
        return ret;
    }

    public static void main(String[] args) {
        int i = countSymmetricIntegers(1,1000000000);
        System.out.println("=================================   "  + i);
    }
}
